# http://xiaorui.cc/2016/02/19/%E4%BB%A3%E7%A0%81%E5%88%86%E6%9E%90python-requests%E5%BA%93%E4%B8%AD%E6%96%87%E7%BC%96%E7%A0%81%E9%97%AE%E9%A2%98/

#!/usr/bin/python
# -*- coding: UTF-8 -*-
import requests

url= 'https://www.farpop.com'
session = requests.session()
html = session.get(url)

print(html.apparent_encoding)
# Out[23]: 'GB2312'
#

# Out[24]: 'gbk'
#暴力解码格式，识别验证码

print(html.content.decode(html.encoding).encode('utf-8'))
print(html.content.decode(html.apparent_encoding,'replace').encode('utf-8'))